package com.bestdreamer.date;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateTest {

    public static void main(String[] args) throws ParseException {

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");

        Date date1 = sdf.parse("2020-10-10");
        Date date2 = sdf.parse("2020-10-03");
        Date date3 = sdf.parse("2020-01-21");
        System.out.println(date1.compareTo(date2));
        System.out.println(date1.compareTo(date3));
        System.out.println(date3.compareTo(date2));
    }

}
